package com.punai.dataanalysis.srlib.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.punai.common.core.domain.BaseEntity;
import com.punai.common.utils.SecurityUtils;
import com.punai.dataanalysis.srlib.vo.GovernmentPriceVo;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.util.Date;

@TableName("analysis_governmentprice_record")
public class AnalysisGovernmentPriceRecord extends BaseEntity {

    private String id;
    private String name;
    private String uploadAddress;
    private Date uploadDate;
    private String uploadUser;

    private String dataStatus = "0";//数据状态  0：为正常，1：为已删除

    private Integer orderNum;
    /**
     * $column.columnComment
     */
    @TableField(fill = FieldFill.INSERT)
    private Long deptId;

    /**
     * $column.columnComment
     */
    @TableField(fill = FieldFill.INSERT)
    private Long userId;

    @TableField(exist = false)
    private String uploadAddressName;

    public static AnalysisGovernmentPriceRecord conversion(GovernmentPriceVo vo, AnalysisGovernmentPriceRecord one, Integer orderNum){
        if(one==null) one=new AnalysisGovernmentPriceRecord();
        one.setName(vo.getName());
        one.setUploadAddress(vo.getUploadAddress());
        one.setUploadDate(vo.getUploadDate());
        one.setUploadUser(SecurityUtils.getUsername());
        one.setOrderNum(vo.getOrderNum());
        return one;
    }
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUploadAddress() {
        return uploadAddress;
    }

    public void setUploadAddress(String uploadAddress) {
        this.uploadAddress = uploadAddress;
    }

    public Date getUploadDate() {
        return uploadDate;
    }

    public void setUploadDate(Date uploadDate) {
        this.uploadDate = uploadDate;
    }

    public String getUploadUser() {
        return uploadUser;
    }

    public void setUploadUser(String uploadUser) {
        this.uploadUser = uploadUser;
    }


    public String getDataStatus() {
        return dataStatus;
    }

    public void setDataStatus(String dataStatus) {
        this.dataStatus = dataStatus;
    }

    public Integer getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUploadAddressName() {
        return uploadAddressName;
    }

    public void setUploadAddressName(String uploadAddressName) {
        this.uploadAddressName = uploadAddressName;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("id", id)
                .append("name", name)
                .append("uploadAddress", uploadAddress)
                .append("uploadDate", uploadDate)
                .append("uploadUser", uploadUser)
                .append("dataStatus", dataStatus)
                .append("orderNum", orderNum)
                .toString();
    }
}
